package com.example.spirngtest.controller;

import com.example.spirngtest.annotations.RateLimiter;
import com.example.spirngtest.domain.DemoData;
import com.example.spirngtest.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @program: cet-practice
 * @description: 本地缓存Caffeine测试
 * @author: 陈恩涛
 * @create: 2023-08-03 22:42
 **/

@RestController
public class CaffeineTestController {

    @Autowired
    private DemoService demoService;

    @RateLimiter(type = "test")
    @GetMapping("/test")
    public List<DemoData> test() {
        return demoService.getAll();
    }

}
